<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSystemUserLevelsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('system_user_levels', function (Blueprint $table) {
            $table->id()->comment('设置用户等级表');
            $table->integer('merchant_id')->nullable()->index()->comment('商户id');
            $table->string('name')->comment('等级名称');
            $table->decimal('money',8,2)->nullable()->comment('购买金额');
            $table->timestamp('valid_date')->nullable()->comment('有效时间');
            $table->integer('system_admin_id')->comment('添加等级的管理人员');
            $table->integer('grade')->comment('会员等级');
            $table->decimal('discount',8,2)->comment('享受折扣');
            $table->string('image')->comment('会员卡背景');
            $table->string('icon')->comment('会员图标');
            $table->text('explain')->comment('等级说明');
            $table->integer('exp_num')->comment('升级经验');
            $table->tinyInteger('is_forever')->default(0)->comment('是否为永久会员 0否 1是');
            $table->tinyInteger('is_pay')->default(0)->comment('是否购买 0=不购买 1=购买');
            $table->tinyInteger('is_show')->default(1)->comment('是否显示 0=隐藏,1=显示');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('system_user_levels');
    }
}
